#include "Game Engine\Header\Player.h"

Player::Player()
{
}

Player::~Player()
{
}

void Player::Init( ID3D10Device* device, btDynamicsWorld* world, std::wstring meshFile,
	ID3D10Effect* fx, ID3D10ShaderResourceView* cubeMap, float mass,
	Physics::Shape shape, bool useShadows )
{
	KinematicBody::Init( device, world, meshFile, fx, cubeMap, mass, shape, useShadows );
}

D3DXVECTOR3& Player::GetPosition()
{
	return KinematicBody::GetPosition();
}

D3DXVECTOR3& Player::GetVelocity()
{
	return KinematicBody::GetVelocity();
}

void Player::SetPosition( D3DXVECTOR3 pos )
{
	KinematicBody::SetPosition( pos );
}

void Player::SetVelocity( D3DXVECTOR3 vel )
{
	KinematicBody::SetVelocity( vel );
}

void Player::Strafe( float d )
{
	KinematicBody::Strafe( d );
}

void Player::Walk( float d )
{
	KinematicBody::Walk( d );
}

void Player::Move( float dt )
{
	if(GetAsyncKeyState( VK_LEFT ) & 0x8000)
	{
		//Strafe( -0.05f );
		Strafe( -mSpeed * dt );
	}
	if(GetAsyncKeyState( VK_RIGHT ) & 0x8000)
	{
		//Strafe( +0.05f );
		Strafe( +mSpeed * dt );
	}
	if(GetAsyncKeyState( VK_UP ) & 0x8000)
	{
		//Walk( +0.05f );
		Walk( +mSpeed * dt );
	}
	if(GetAsyncKeyState( VK_DOWN ) & 0x8000)
	{
		//Walk( -0.05f );
		Walk( -mSpeed * dt );
	}

	if(GetAsyncKeyState( VK_RETURN ) & 0x8000)
	{
		//Walk( -0.05f );
		mCharacter->jump(); //( -mSpeed * dt );
	}

	KinematicBody::Move( dt );
}

void Player::Stop()
{
	KinematicBody::Stop();
}

void Player::Draw( D3DXMATRIX& lightViewProj )
{
	KinematicBody::Draw( lightViewProj );
}

btPairCachingGhostObject* Player::GetGhostObject()
{
	return KinematicBody::GetGhostObject();
}

btKinematicCharacterController* Player::GetCharacter()
{
	return KinematicBody::GetCharacter();
}